ARCH=@ARCH@
DEFINES+=-DHAS_SDL
CXXFLAGS=-fPIC
OBJS=nastyfft.o plugin.o

SLIB=@abs_top_srcdir@/addons/visualization.nastyfft/nastyfft.vis

ifeq (@USE_OPENGLES@,1)
  OBJS+=../EGLHelpers/Shader.o ../EGLHelpers/GUIShader.o ../../guilib/MatrixGLES.o
  DEFINES+=-DHAS_GLES
else
  DEFINES+=-DHAS_SDL_OPENGL
endif

$(SLIB): $(OBJS)
ifeq ($(findstring osx,$(ARCH)), osx)
  ifeq (@ARCH@, arm-osx)
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ $(OBJS) -framework OpenGLES
  else
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -Wl,-alias_list,@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper_mach_alias \
	-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
	@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS)
  endif
else
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -g -o $(SLIB) $(OBJS)
endif

include @abs_top_srcdir@/Makefile.include
